const app = getApp()
Component({
  data: {
    num: '',
    selected: 0,
    color: "#555555",
    selectedColor: "#F6221B",
    borderStyle: "black",
    backgroundColor: "#ffffff",
    list: [{
      pagePath: "/index/index",
      iconPath: "/image/home.png",
      selectedIconPath: "/image/home1.png",
      text: "首页"
    }, 
    {
      pagePath: "/index/index3",
      iconPath: "/image/jf.png",
      selectedIconPath: "/image/jf1.png",
      text: "积分商城",
    }, 
    {
      pagePath: "/index/index1",
      iconPath: "/image/message.png",
      selectedIconPath: "/image/message1.png",
      text: "消息"
    }, {
      pagePath: "/index/index2",
      iconPath: "/image/my.png",
      selectedIconPath: "/image/my1.png",
      text: "我的"
    }]
  },
  attached() {

  },
  methods: {
    switchTab(e) {
      const {
        index
      } = e.currentTarget.dataset
      let {
        pagePath,
        jump
      } = this.data.list[index]
      if (jump) {
        wx.navigateTo({
          url: pagePath,
        })
      } else {
        this.setData({
          selected: index
        })
        wx.switchTab({
          url: pagePath
        })
      }
    },
  }
})